<template>
	<view class="container">
		<u-navbar title='回访' :title-bold='true' :border-bottom='false' :is-fixed='true' ></u-navbar>
		<!--  -->
		<view class="main">
			<view class="fixed card" @click="show=true">
				<span>诊断日期</span>
				<view style="color: #c0c4cc;">
					 {{form.followday||'请选择开始时间'}}
					<u-icon style="margin-left: 16rpx;" name="arrow-right" color="##c0c4cc" size="26"></u-icon>
				</view>
			</view>
			<view class="card" @click="show=true">
				<span>诊断问题</span>
				<u-input v-model="form.problem" type="textarea" :height='140' placeholder='请填写诊断问题'   />
			</view>
		</view>
		<!--  -->
		<view class="btn" @click="submit">确认回访</view>
		<!--  -->
		<u-picker v-model="show" :params="params" mode="time" @confirm="followTime"></u-picker>
		<!-- 提示 -->
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import {addfollow}from '../../api/index.js'
	export default{
		data(){
			return{
				show:false,
				form:{
					followday:'',
					problem:''
				},
				params: {
									year: true,
									month: true,
									day: true,
									hour: false,
									minute: false,
									second: false
								},
			}
		},
		onLoad(e) {
			console.log(e.id);
			this.form.user_id=e.id
		},

		methods:{
			followTime(e){
				this.form.followday= e.year+'-'+e.month+'-'+e.day
			},
			submit(){
				let that = this
				addfollow(that.form).then(res=>{
					if(res.code==1){
						uni.navigateBack()
					}else{
						that.$refs.uToast.show({
							title: res.msg
						})
					}
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.container{
		height: 100vh;
		background-color: #EEE;
		padding: 40rpx 0;
		.fixed{
			display: flex;
			justify-content: space-between;
			align-items: center;
		}
		.card{
			background-color: #FFF;
			padding: 30rpx;
		}
		
	}
</style>